package cn.lyj.study.util;


import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class MyFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {

    }

    public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        HttpServletResponse response1 = (HttpServletResponse) response;
        response1.setCharacterEncoding("utf-8");
        response1.setContentType("text/html,charset=utf-8");
        response1.setHeader("Access-Control-Allow-Origin", "*");
        filterChain.doFilter(servletRequest,response1);
    }

    public void destroy() {

    }
}
